import { request } from '@gui-pkg/request';

enum Api {
  getOptionselect='/api/data/sys/role/optionselect',
  getRoleList = '/api/data/sys/role/list',
  addRole = '/api/data/sys/role',
  editRole = '/api/data/sys/role/edit',
  delRole = '/api/data/sys/role/delete/',
  changeRoleStatus = '/api/data/sys/role/changeStatus',
}
export const getOptionselect = () => {
  return request.get({ url: Api.getOptionselect });
};
//获取角色列表
export const getRoleList = (params) => {
  return request.get({ url: Api.getRoleList, params });
};

//根据角色获取对应的菜单树
export const getRoleDetail = (roleId) => {
  return request.get({ url: `/api/data/sys/role/${roleId}` });
};

//添加角色
export const addRole = (params) => {
  return request.post({ url: Api.addRole, params });
};

//修改角色
export const editRole = (params) => {
  return request.post({ url: Api.editRole, params });
};

//删除角色
export const delRole = (params) => {
  return request.get({ url: Api.delRole+params });
};

//修改角色状态
export const changeRoleStatus = (params) => {
  return request.post({ url: Api.changeRoleStatus,params });
};
